import java.io.StringWriter;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
/**
 * @(#)LearnSpring.java
 *
 *
 * @author 
 * @version 1.00 2009/10/19
 */

public class LearnSpring {
        
    /**
     * Creates a new instance of <code>LearnSpring</code>.
     */
    public LearnSpring() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)throws Exception {
       /* first, get and initialize an engine */
	   VelocityEngine ve = new VelocityEngine();
	   ve.init();
	   /* next, get the Template */
	   Template t = ve.getTemplate( "hello.vm" );
	   /* create a context and add data */
	   VelocityContext context = new VelocityContext();
	   context.put("name", "Eiffel Qiu");
	   context.put("site", "http://www.j2medev.com");
	   /* now render the template into a StringWriter */
	   StringWriter writer = new StringWriter();
	   t.merge( context, writer );
	   /* show the World */
	   System.out.println( writer.toString() ); 
    }
}
